On X11, we get both smooth and emulated scroll events, whereas other
backends such as wayland will give smooth events only with touchpad
scrolling.
Discard emulated scroll events so that we get consistent behaviours
between backends.
Allow for both horizontal and vertical smooth events for scrolling so
that horizontal scrolling still works without emulated scroll events as
well, again for consistency between gdk backends.
https://bugzilla.gnome.org/show_bug.cgi?id=765939
#include <gobject/gvaluecollector.h>
+#include <gdk/gdkprivate.h> /* for _gdk_event_get_pointer_emulated() */
+
#include "gtkaccellabel.h"
#include "gtkaccelmap.h"
#include "gtkadjustment.h"
{
GtkMenu *menu = GTK_MENU (widget);
+ if (_gdk_event_get_pointer_emulated ((GdkEvent *) event))
+ return FALSE;
+
switch (event->direction)
{
case GDK_SCROLL_RIGHT:
gtk_menu_scroll_by (menu, - MENU_SCROLL_STEP2);
break;
case GDK_SCROLL_SMOOTH:
- gtk_menu_scroll_by (menu, event->delta_y);
+ gtk_menu_scroll_by (menu, event->delta_y * MENU_SCROLL_STEP2);
break;
}